import { defineStore } from 'pinia'

export const useAgentStore = defineStore('agent', {
  state: () => ({
    userName: 'admin',
    userId: '1',
    token: localStorage.getItem('token') ?? '',
  }),
  actions: {
    setUserName(userName: string) {
      this.userName = userName
    },
    setUserId(userId: string) {
      this.userId = userId
    },
    setToken(token: string) {
      this.token = token
      localStorage.setItem('token', token)
    },
  },
})
